package de.sendorian.app.forumArchive.matcher;


import org.hamcrest.Description;
import org.hamcrest.TypeSafeDiagnosingMatcher;

import de.sendorian.app.forumArchive.domain.Topic;

public class AnnouncementAndStickyTopicMatcher extends TypeSafeDiagnosingMatcher<Topic> {

	private Topic topic;

	@Override
	protected boolean matchesSafely(Topic topic, Description mismatchDescription) {
		this.topic = topic;
		return topic.getType() == Topic.Type.ANNOUNCEMENT
		    || topic.getType() == Topic.Type.STICKY_TOPIC;
	}


	public void describeTo(Description description) {
		description.appendText(" that topic ");
		description.appendValue(topic);
		description.appendText(" is of type announcement or sticky topic");
	}

}
